<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page contentType="text/html; charset=UTF-8" language="java" errorPage=""%>
<html xmlns="urn:jsptagdir:/WEB-INF/tags">
<%--include指令--%>
<head>
    <title>无标题文档</title>
    <style type="text/css">
        /*#apDiv1 {*/
            /*position:absolute;*/
            /*left:400px;*/
            /*top:38px;*/
            /*width:348px;*/
            /*height:182px;*/
            /*z-index:1;*/
            /*background-color: #000000;*/
        /*}*/
        #apDiv2 {
            position:absolute;
            left:400px;
            top:222px;
            width:348px;
            height:41px;
            background-color: #993333;
        }

    </style>
</head>
<%!
    public int count;
    public String info()
    {
        return "hello!";
    }
%>

<body>
<%@include file="scriptlet.jsp"%>
<%--JSP脚本，使用脚本动态生成10行--%>
<table bgcolor="#9999dd" border="1" width="300px">
<%
    for(int i=0;i<10;i++)
    {
        %>
    <tr>
        <td>循环值：</td>
        <td><%=i%></td>
    </tr>
<%
    }
%>
</table>
<%--JSP脚本查询数据库--%>
<%
    Class.forName("com.mysql.jdbc.Driver");
    Connection conn= DriverManager.getConnection("jdbc:mysql://localhost:3306/1613580002","root","tjxwq42222");
    Statement stmt=conn.createStatement();
    ResultSet rs=stmt.executeQuery("select * from t_news");
%>
<table bgcolor="#9999dd" border="1" width="300px">
    <%
        while(rs.next())
        {
    %>
    <tr>
        <td>输出结果集</td>
        <td><%=rs.getString(1)%></td>
        <td><%=rs.getString(2)%></td>
    </tr>
    <%
        }
    %>
</table>
<%--include指令--%>
<%--<div id="apDiv1"></div>--%>
<div id="apDiv2"></div>
<%--输出表达式--%>
<%=count++%>
</br>
<%=info()%>
<%
    out.println(count++);
    out.println(info());
%>
<h2>Hello 田俊秀!</h2>
</body>
</html>
